package com.xinhua.erp.controller;

import com.xinhua.erp.pojo.Authority;
import com.xinhua.erp.pojo.Result;
import com.xinhua.erp.pojo.Role;
import com.xinhua.erp.service.AuthorityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName AuthorityController
 * @Description TODO
 * @Date 2019/12/26 下午11:21
 * @Version 1.0
 **/
@RestController
@RequestMapping(value = "authority")
public class AuthorityController {

    @Autowired
    private AuthorityService authorityService;

    @GetMapping("{id}")
    public Result findById(@PathVariable long id) {
        return authorityService.findById(id);
    }

    @DeleteMapping("{id}")
    public Result deleteById(@PathVariable long id) {
        return authorityService.deleteById(id);
    }

    @PostMapping
    public Result save(@RequestBody Authority authority) {
        return authorityService.save(authority);
    }

    @PutMapping
    public Result update(@RequestBody Authority authority) {
        return authorityService.update(authority);
    }


}
